<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="file" id="file" name="file" multiple>
<button id="upload">上传</button>
    <script>
        var fileInput = document.getElementById('file');
        var myHeaders = new Headers();
        // myHeaders.append("User-Agent", "Apifox/1.0.0 (https://apifox.com)");
        // myHeaders.append("Accept", "*/*");
        myHeaders.append("Host", "localhost:80");
        myHeaders.append("Connection", "keep-alive");


        document.getElementById('upload').onclick = () => {
            var formdata = new FormData();
            console.log(fileInput.files);
            formdata.append("file", fileInput.files[0], "1.png");
            formdata.append("file", fileInput.files[1], "屏幕截图 2025-01-19 133158.png");
            var requestOptions = {
                method: 'POST',
                headers: myHeaders,
                body: formdata,
                redirect: 'follow'
            };
            fetch("http://localhost:80/upload", requestOptions)
                .then(response => response.text())
                .then(result => console.log(result))
                .catch(error => console.log('error', error));
        }
    </script>
</body>
</html>